	<?php 
		$type = $this->input->post('type') ;
		$key = $this->input->post('key') ;
		$category_id_post = $this->input->post('category_id') ;
		$match_id_post = $this->input->post('match_id') ;
		
	?>
	
	<?php 
		$inningArray = $this->feed->getInning($type,$key,$match_id_post);
		$currentInfo = $this->feed->getCurrentMatchInfo($type,$key,$match_id_post);
		if($currentInfo){
			$localteam_name = $currentInfo['localteam_name'];
			$visitorteam_name = $currentInfo['visitorteam_name'];
		}
		
		$inningNum = array();
		foreach($inningArray as $k =>$val){
			$inningNum[] = $val['attributes']['inningnum'];
		}
		
		$latest = $inningNum[0];
	 
	?>
	
	<?php if($inningArray):?>
	
	<?php foreach($inningArray as $k => $val):?>	
		<?php if($latest == $val['attributes']['inningnum']):?>
		
			Inning Name: <?php echo $val['attributes']['name'];?>	<br />
			Team: <?php if($val['attributes']['team'] == 'visitorteam'){echo $visitorteam_name;}else{echo $localteam_name;} ?> <br />
			
				<b>Batsmanstats:</b>
				<table>
					<thead>
						<th>batsman</th>
						<th>status</th>
						<th>r</th>
						<th>b</th>
						<th>s4</th>
						<th>s6</th>
						<th>sr</th>
						<th>bat</th>
						<th>id</th>
					</thead>
					<tbody>
					<?php foreach($val['batsmanstats'] as $item):?>
						<tr>
							<td><?php echo $item['batsman'];?></td>
							<td><?php echo $item['status'];?></td>
							<td><?php echo $item['r'];?></td>
							<td><?php echo $item['b'];?></td>
							<td><?php echo $item['s4'];?></td>
							<td><?php echo $item['s6'];?></td>
							<td><?php echo $item['sr'];?></td>
							<td><?php echo $item['bat'];?></td>
							<td><?php echo $item['id'];?></td>
						</tr>
					<?php endforeach; ?>	
					</tbody>
				</table>	
			 
			
			<b>Totals: </b>
			<?php foreach($val['totals'] as $k=> $value):?>
				&nbsp;<b><?php echo $k;?>:</b><?php echo $value."&nbsp;&nbsp;";?>
			<?php endforeach; ?>
			<br />
			
			<b>Bowlers:</b>	
			<table>
				<thead>
					<th>bowler</th>
					<th>o</th>
					<th>m</th>
					<th>r</th>
					<th>w</th>
					<th>nb</th>
					<th>wd</th>
					<th>er</th>
					<th>ball</th>
					<th>id</th>
				</thead>
				<tbody>
				<?php foreach($val['bowlers'] as $item):?>
					<tr>
						<td><?php echo $item['bowler'];?></td>
						<td><?php echo $item['o'];?></td>
						<td><?php echo $item['m'];?></td>
						<td><?php echo $item['r'];?></td>
						<td><?php echo $item['w'];?></td>
						<td><?php echo $item['nb'];?></td>
						<td><?php echo $item['wd'];?></td>
						<td><?php echo $item['er'];?></td>
						<td><?php echo $item['ball'];?></td>
						<td><?php echo $item['id'];?></td>
					</tr>
				<?php endforeach; ?>	
				</tbody>
			</table>	
			<b>Partnerships:</b>
			<table>
				<thead>
					<th>partnership</th>
					<th>rb1</th>
					<th>rb2</th>
					<th>ex</th>
					<th>total</th>
					<th>id</th>
				</thead>
				<tbody>
				<?php foreach($val['partnerships'] as $item):?>
					<tr>
						<td><?php echo $item['partnership'];?></td>
						<td><?php echo $item['rb1'];?></td>
						<td><?php echo $item['rb2'];?></td>
						<td><?php echo $item['ex'];?></td>
						<td><?php echo $item['total'];?></td>
						<td><?php echo $item['id'];?></td>
					</tr>
				<?php endforeach; ?>	
				</tbody>
			</table>	
		 <hr/>
		<?php endif;?>	 
	<?php endforeach;?>
<?php endif;?>
 

